package com.pengtu.gsj.service.impl.system;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pengtu.gsj.dao.base.Page;
import com.pengtu.gsj.dao.base.QueryFilter;
import com.pengtu.gsj.dao.system.BannerDao;
import com.pengtu.gsj.entity.app.Banner;
import com.pengtu.gsj.service.system.BannerService;

@Transactional
@Service
public class BannerServiceImpl implements BannerService {
	
	@Autowired
	private BannerDao bannerDao;

	@Override
	public List<Banner> getBanners(QueryFilter queryFilter) {
		return bannerDao.find(queryFilter, "sort", true);
	}

	@Override
	public Page<Banner> findbanners(Page<Banner> page, QueryFilter queryFilter) {
		return bannerDao.findPage(page, queryFilter);
	}

	@Override
	public Banner getBanner(String id) {
		return bannerDao.get(id);
	}

	@Override
	public void saveBanner(Banner banner) {
		bannerDao.save(banner);
	}

	@Override
	public void deleteBanner(String id) {
			bannerDao.delete(id);
			
	}

	@Override
	public List<Banner> getAll() {
		return bannerDao.getAll("sort", true);
	}
}
